package com.firefly.dao.dto.cms;

import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.*;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @description: 文章
 * @author: lzg(萤火科技 ： 854378082 @ qq.com)
 * @date: 2022/12/20
 **/
@Data
@EqualsAndHashCode
public class ArticleDto implements Serializable {
    private static final long serialVersionUID = 1L;
    @Positive(groups = {update.class}, message = "ID是大于0的整数")
    private Integer id;
    @PositiveOrZero(groups = {create.class, update.class}, message = "栏目必须填写")
    private Integer cateId;
    @Size(min = 1, max = 255, groups = {create.class, update.class}, message = "标题长度不正确")
    private String title;
    private String keywords;
    @Size(min = 0, max = 255, groups = {create.class, update.class}, message = "图片地址长度不正确")
    private String thumb;
    private String description;
    @NotNull(groups = {create.class, update.class}, message = "内容不能为空")
    private String content;
    private String tpl;
    @Range(min = 0, max = 1, groups = {create.class, update.class}, message = "是否推荐值不正确")
    private Integer pushFlag;
    @Size(min = 0, max = 255, groups = {create.class, update.class}, message = "来源不正确")
    private String source;
    @Range(min = 0, max = 1, groups = {create.class, update.class}, message = "是否外链接值不正确")
    private Integer linkFlag;
    @Size(min = 0, max = 255, groups = {create.class, update.class}, message = "链接地址长度不正确")
    private String url;
    @PositiveOrZero(groups = {create.class, update.class}, message = "排序值不正确")
    private Integer sort;
    @PositiveOrZero(groups = {create.class, update.class}, message = "点击量不正确")
    private Integer hits;
    @NotNull(groups = {create.class, update.class}, message = "发布时间必须填写")
    private LocalDateTime publishAt;
    public interface create {}
    public interface update {}
}
